package com.jxs.tourist.service.impl;

import com.jxs.tourist.dao.TouristDao;
import com.jxs.tourist.domain.Tourist;
import com.jxs.tourist.service.TouristService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TouristServiceImpl implements TouristService {
    @Autowired
    TouristDao touristDao;
    public TouristServiceImpl(){
        System.out.println("init");
    }

    public int addTourist(Tourist tourist) {
        return touristDao.addTourist(tourist);
    }

    public List<Tourist> getAllTourist() {
        return touristDao.getAllTourist();
    }

    public List<Tourist> getTouristByCityId(int city_id) {
        return touristDao.getTouristByCityId(city_id);
    }

    public List<Tourist> searchTouristByName(String name) {
        return touristDao.searchTouristByName(name);
    }

    public int editTourist(Tourist tourist) {
        return touristDao.editTourist(tourist);
    }

    public int delTouristById(int id) {
        return touristDao.delTouristById(id);
    }

    public Tourist getTouristById(int id) {
        return touristDao.getTouristById(id);
    }

    public String getTouristNameById(int tourist_id) {
        return touristDao.getTouristNameById(tourist_id);
    }
}
